package com.xx.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

@Controller
@RequestMapping("/hello")
public class MyController {
    @RequestMapping("/do")
    public ModelAndView hello() {
        ModelAndView modelAndView = new ModelAndView();
        modelAndView.addObject("msg", "hello");
        modelAndView.setViewName("hello");
        System.out.println("do");
        return modelAndView;
    }

    @RequestMapping("/redirect")
    public ModelAndView redirect() {
        ModelAndView modelAndView = new ModelAndView();
        modelAndView.addObject("msg", "redirect");
        modelAndView.setViewName("redirect");
        System.out.println("redirect ");
        return modelAndView;
    }

    @RequestMapping("/forward")
    public ModelAndView forward() {
        ModelAndView modelAndView = new ModelAndView();
        modelAndView.addObject("msg", "forward");
        modelAndView.setViewName("forward");
        System.out.println("forward");
        return modelAndView;
    }
}
